package com.gdw;

import com.gdw.component.BeanLifecycleComponent;
import com.gdw.controller.UserController;
import com.gdw.controller.UserController2;
import com.gdw.entity.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.stereotype.Controller;

public class App {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
        /*UserController userController = context.getBean("userController", UserController.class);
        userController.printUser();

        UserController2 userController2 = context.getBean("userController2", UserController2.class);
        userController2.printUser2();*/
        BeanLifecycleComponent lifecycleComponent = context.getBean(BeanLifecycleComponent.class);
        lifecycleComponent.use();
        //销毁
        context.destroy();

    }
}
